home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_enlightenment.idb / usr / freeware / bin / e_gen_menu.z / e_gen_menu
Text File  |  2001-10-09  |  5KB  |  118 lines

  1. #!/bin/sh
  2. ##############################################################################
  3. # generates a file.menu format for Enlightenment out of menu hierarchies      #
  4. #
  5. # Copyright (C) 1999 Carsten Haitzler, Geoff Harrison  and various contributors
  6. # Permission is hereby granted, free of charge, to any person obtaining a copy
  7. # of this software and associated documentation files (the "Software"), to
  8. # deal in the Software without restriction, including without limitation the
  9. # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  10. # sell copies of the Software, and to permit persons to whom the Software is
  11. # furnished to do so, subject to the following conditions:
  12. # The above copyright notice and this permission notice shall be included in
  13. # all copies of the Software, its documentation and marketing & publicity
  14. # materials, and acknowledgment shall be given in the documentation, materials
  15. # and software packages that this Software was used.
  16. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. # THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20. # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. ##############################################################################
  23.  
  24. PATH=$PATH:"/usr/local/enlightenment/bin:/usr/enlightenment/bin:/opt/enlightenment/bin:/usr/local/bin:"$EBIN
  25. export PATH
  26.  
  27. OUT_DIR=$ECONFDIR
  28. OUT=$OUT_DIR"/file.menu"
  29.  
  30. WINDOWID=`eesh -ewait window_list | awk '$3 ~ "^Message$" { printf("%s ", $1)}'`
  31. for i in $WINDOWID; do
  32.   eesh -e "win_op "$i" close"
  33. done
  34.  
  35. eesh -e "dialog_ok Menus are being generated... Please Wait."
  36. WINDOWID=`eesh -ewait window_list | awk '$3 ~ "^Message$" { printf("%s ", $1)}'`
  37.  
  38. e_gen_kde_menu menus_kde $OUT_DIR $OUT_DIR"/kde.menu"
  39. e_gen_gnome_menu menus_gnome $OUT_DIR $OUT_DIR"/gnome.menu"
  40. e_gen_gnome_menu menus_gnome $OUT_DIR $OUT_DIR"/gnome_user.menu" $HOME/".gnome/apps"
  41.  
  42. # if the out dir doesnt exist - make it 
  43. if [ ! -d "$OUT_DIR" ]; then
  44.   mkdir $OUT_DIR
  45. fi
  46.  
  47. # find eesh
  48. EESH=`which eesh`
  49. # generate file menu if it doesn't exist
  50. if [ ! -f "$OUT" ]; then
  51.   echo \"User Menus\" > $OUT
  52.   echo \"User Application list\" NULL menu \"user_apps.menu\" >> $OUT
  53.   echo \"KDE\" NULL menu \"kde.menu\" >> $OUT
  54.   echo \"GNOME\" NULL menu \"gnome.menu\" >> $OUT
  55.   echo \"GNOME User Menu\" NULL menu \"gnome_user.menu\" >> $OUT
  56.   echo \"Enlightenment Epplets\" NULL menu \"epplets.menu\" >> $OUT
  57.   # if we have eesh available
  58.   if [ -n "$EESH" ]; then
  59.     echo \"Restart Enlightenment\" NULL exec \"$EESH -e \'restart\'\" >> $OUT
  60.     echo \"Log Out\" NULL exec \"$EESH -e \'exit\'\" >> $OUT
  61.   fi
  62. fi
  63. touch $OUT
  64.  
  65. # generate menu looking for Epplets - you might not have any yet.... but expect to
  66. OUT=$OUT_DIR"/epplets.menu"
  67. EPPLETS="`/bin/ls $EBIN"/"*.epplet 2> /dev/null`"
  68. if [ -n "$EPPLETS" ]; then
  69.   echo \"Enlightenment Epplets\" > $OUT
  70.   echo "$EPPLETS" | \
  71.     sed -e 's:\(^.*/\([^/]*\).epplet$\):\"\2\" \"'$EROOT'/epplet_icons/\2.icon\" exec \"\1\":' \
  72.     >> $OUT
  73. fi
  74. touch $OUT
  75.  
  76. # generate a stub user_apps menu if it doesnt exist
  77. OUT=$OUT_DIR"/user_apps.menu"
  78. if [ ! -f "$OUT" ]; then
  79.   echo \"User Application List\" > $OUT
  80.   echo \"Eterm\" NULL exec \"Eterm\" >> $OUT
  81.   echo \"XTerm\" NULL exec \"xterm\" >> $OUT
  82.   echo \"RXVT\" NULL exec \"rxvt\" >> $OUT
  83.   echo \"KTerm\" NULL exec \"kterm\" >> $OUT
  84.   echo \"Gnome Terminal\" NULL exec \"gnome-terminal\" >> $OUT
  85.   echo \"Netscape\" NULL exec \"netscape\" >> $OUT
  86.   echo \"TkRat\" NULL exec \"tkrat\" >> $OUT
  87.   echo \"Netscape Mail\" NULL exec \"netscape -mail -no-about-splash\" >> $OUT
  88.   echo \"Balsa\" NULL exec \"balsa\" >> $OUT
  89.   echo \"Exmh\" NULL exec \"exmh\" >> $OUT
  90.   echo \"Electric Eyes\" NULL exec \"ee\" >> $OUT
  91.   echo \"The GIMP\" NULL exec \"gimp\" >> $OUT
  92.   echo \"XV\" NULL exec \"xv\" >> $OUT
  93.   echo \"GQView\" NULL exec \"gqview\" >> $OUT
  94.   echo \"XMag\" NULL exec \"xmag\" >> $OUT
  95.   echo \"XawTV\" NULL exec \"xawtv\" >> $OUT
  96.   echo \"Imlib Settings\" NULL exec \"imlib_config\" >> $OUT
  97.   echo \"X-Chat\" NULL exec \"xchat\" >> $OUT
  98.   echo \"XMan\" NULL exec \"xman\" >> $OUT
  99.   echo \"TkMan\" NULL exec \"tkman\" >> $OUT
  100.   echo \"GnomeICU\" NULL exec \"gnomeicu -a\" >> $OUT
  101.   echo \"eMusic\" NULL exec \"emusic\" >> $OUT
  102.   echo \"X11Amp\" NULL exec \"x11amp\" >> $OUT
  103.   echo \"XMMS\" NULL exec \"xmms\" >> $OUT
  104.   echo \"FreeAmp\" NULL exec \"freeamp\" >> $OUT
  105.   echo \"Civilization\" NULL exec \"civctp\" >> $OUT
  106.   echo \"Myth 2\" NULL exec \"myth2\" >> $OUT
  107. fi
  108. touch $OUT
  109.  
  110. for i in $WINDOWID; do
  111.   eesh -e "win_op "$i" close"
  112. done
  113. eesh -e "reload_menus"
  114. eesh -e "dialog_ok Menu generation complete."
  115.